package com.edu.exam.enums.curriculum.questionbank;

/**
 * 转码状态枚举
 * 定义媒体文件的转码处理状态
 *
 * @author System
 * @version 1.0.0
 */
public enum TranscodeStatus {

    /**
     * 等待转码
     */
    PENDING("等待转码", "文件等待转码处理"),

    /**
     * 转码中
     */
    TRANSCODING("转码中", "文件正在转码处理"),

    /**
     * 转码成功
     */
    SUCCESS("转码成功", "文件转码处理成功"),

    /**
     * 转码失败
     */
    FAILED("转码失败", "文件转码处理失败"),

    /**
     * 转码取消
     */
    CANCELLED("转码取消", "文件转码处理已取消"),

    /**
     * 不需要转码
     */
    NOT_REQUIRED("不需要转码", "文件格式无需转码"),

    /**
     * 转码队列中
     */
    QUEUED("队列中", "文件在转码队列中等待"),

    /**
     * 重试中
     */
    RETRYING("重试中", "转码失败后正在重试");

    private final String description;
    private final String detail;

    TranscodeStatus(String description, String detail) {
        this.description = description;
        this.detail = detail;
    }

    public String getDescription() {
        return description;
    }

    public String getDetail() {
        return detail;
    }

    /**
     * 判断是否为完成状态
     */
    public boolean isCompleted() {
        return this == SUCCESS || this == FAILED || this == CANCELLED || this == NOT_REQUIRED;
    }

    /**
     * 判断是否为处理中状态
     */
    public boolean isProcessing() {
        return this == TRANSCODING || this == RETRYING;
    }

    /**
     * 判断是否为等待状态
     */
    public boolean isWaiting() {
        return this == PENDING || this == QUEUED;
    }
}